using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Caching;

namespace NET.Library.Caching
{
    /// <summary>
    /// Wrapper object for Microsoft.Practices.EnterpriseLibrary.Caching
    /// </summary>
    public class Cache
    {
        #region Constructors
        /// <summary>
        /// Cache Constructor
        /// </summary>
        public Cache()
        {
            CacheManager cache = CacheFactory.GetCacheManager();
            
        }
        /// <summary>
        /// Cache Constructor
        /// </summary>
        /// <param name="cacheManagerName"></param>
        public Cache(string cacheManagerName)
        {
            CacheManager cache = CacheFactory.GetCacheManager(cacheManagerName);

        }
        #endregion

        #region Instance Methods
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Add item to the cache
        /// </summary>
        /// <param name="key">Name of the item to add</param>
        /// <param name="value">The item to add</param>
        ///----------------------------------------------------------------------------------
        public void Add(string key, object value)
        {
            this.Add(key, value);
        }
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Add item to the cache
        /// </summary>
        /// <param name="key">Name of the item to add</param>
        /// <param name="value">The item to add</param>
        /// <param name="scavengingPriority"></param>
        /// <param name="refreshAction"></param>
        /// <param name="expirations"></param>
        ///----------------------------------------------------------------------------------
        public void Add(string key, object value, CacheItemPriority scavengingPriority, ICacheItemRefreshAction refreshAction, params ICacheItemExpiration[] expirations)
        {
            this.Add(key, value, scavengingPriority, refreshAction, expirations);
        }
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Return item from the cache
        /// </summary>
        /// <param name="key">Name of the item to return</param>
        /// <returns>Item as object</returns>
        ///----------------------------------------------------------------------------------
        public object GetData(string key)
        {
            return this.GetData(key);
        }
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Remove item from the cache
        /// </summary>
        /// <param name="key">Name of the item to remove</param>
        ///----------------------------------------------------------------------------------
        public void Remove(string key)
        {
            this.Remove(key);
        }
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Return a count of the number of items in the cache
        /// </summary>
        /// <returns>The number of items in the cache</returns>
        ///----------------------------------------------------------------------------------
        public int Count()
        {
            return this.Count();
        }
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Check for the existence of an item in the cache
        /// </summary>
        /// <param name="key">Name of item to check for</param>
        /// <returns>True if the item exists in the cache</returns>
        ///----------------------------------------------------------------------------------
        public bool Contains(string key)
        {
            if(this.Contains(key))
                return true;
            else
                return false;
                   
        }
        ///----------------------------------------------------------------------------------
        /// <summary>
        /// Remove all items from the cache
        /// </summary>
        ///----------------------------------------------------------------------------------
        public void Flush()
        {
            this.Flush();
        }
        #endregion

    }
}
